/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package agent;

import controlSystem.ControlSystem;
import java.util.ArrayList;
import knowlegeBase.KnowlegeBase;
import robosym.visual.Barrier;

/**
 *
 * @author Lucky
 */
public class Brain {
    private Agent agent;
    private float toX;
    private float toY;
    private float[][] route;

    public Brain(Agent agent){
        this.agent = agent;
        setRoute();
    }

    public void setToBaseWhatSeeMyAgent(){
        Barrier[] whatSee = agent.getSightBarriers();
        for(int i=0; i<whatSee.length;i++)
            KnowlegeBase.getInstance().addBarrier(whatSee[i]);
    }

    public void nextStep(){
        agent.gotoXY(getRoute()[1][0], getRoute()[1][1]);
    }

    public void setRoute(){
        int len = 3; //длинна маршрута, перед этим вызвать метод построения маршрута
        route = new float[len][2];
        //route = класс.ПостройМаршрут, элемент ([0][0], [0][1]) - текущее положение агента
    }

        /**
     * @return the route
     */
    public float[][] getRoute() {
        return route;
    }

    public void addMeToControlSystem(){
        ControlSystem.getInstance().addBrainToControlSystem(this);
    }

    /**
     * @return the toX
     */
    public float getToX() {
        return toX;
    }

    /**
     * @param toX the toX to set
     */
    public void setToX(float toX) {
        this.toX = toX;
    }

    /**
     * @return the toY
     */
    public float getToY() {
        return toY;
    }

    /**
     * @param toY the toY to set
     */
    public void setToY(float toY) {
        this.toY = toY;
    }

}

